--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test/python_helpers/is_logged_in.py main (dac94b89) Text, 1.31 KB
T8b949e#!/usr/bin/env python3
T8b949e# nomadForum - a forum on the NomadNetwork
T8b949e# Copyright (C) 2023-2026 AutumnSpark1226
T8b949e#
T8b949e# This program is free software: you can redistribute it and/or modify
T8b949e# it under the terms of the GNU General Public License as published by
T8b949e# the Free Software Foundation, either version 3 of the License, or
T8b949e# (at your option) any later version.
T8b949e#
T8b949e# This program is distributed in the hope that it will be useful,
T8b949e# but WITHOUT ANY WARRANTY; without even the implied warranty of
T8b949e# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
T8b949e# GNU General Public License for more details.
T8b949e#
T8b949e# You should have received a copy of the GNU General Public License
T8b949e# along with this program. If not, see <https://www.gnu.org/licenses/>.
Tff7b72import T7ee787os
Tff7b72import T7ee787sys
Te6edf3sysTff7b72.Td2a8ffpathTff7b72.Td2a8ffextendTb4b4b4(
Tb4b4b4[
Te6edf3osTff7b72.Td2a8ffpathTff7b72.Td2a8ffabspathTb4b4b4(
Te6edf3osTff7b72.Td2a8ffpathTff7b72.Td2a8ffjoinTb4b4b4(Te6edf3osTff7b72.Td2a8ffpathTff7b72.Td2a8ffjoinTb4b4b4(Te6edf3osTff7b72.Td2a8ffpathTff7b72.Td2a8ffdirnameTb4b4b4(Tff7b72__file__Tb4b4b4)Tb4b4b4, Te6edf3osTff7b72.Td2a8ffpardirTb4b4b4)Tb4b4b4, Te6edf3osTff7b72.Td2a8ffpardirTb4b4b4)
Tb4b4b4)
Tb4b4b4]
Tb4b4b4)
Tff7b72import T7ee787main
Te6edf3s Tff7b72= Te6edf3mainTff7b72.Td2a8ffhandle_idsTb4b4b4(Tb4b4b4)
Te6edf3return_code Tff7b72= T79c0ff1
Tff7b72if Te6edf3sTff7b72.Td2a8ffis_logged_inTb4b4b4(Tb4b4b4)Tb4b4b4:
T8b949e# use return code 10 for being logged in, 0 might be used by called functions for errors
Te6edf3return_code Tff7b72= T79c0ff10
Tffa657printTb4b4b4(Ta5d6fffTa5d6ff"Ta5d6ffuser Ta5d6ff'Tffd700{Te6edf3sTff7b72.Td2a8ffget_usernameTb4b4b4(Tb4b4b4)Tffd700}Ta5d6ff'Ta5d6ff is logged inTa5d6ff"Tb4b4b4)
Tff7b72elseTb4b4b4:
T8b949e# use return code 11 for not being logged in
Te6edf3return_code Tff7b72= T79c0ff11
Tffa657printTb4b4b4(Ta5d6ff"Ta5d6ffuser is not logged inTa5d6ff"Tb4b4b4)
Te6edf3mainTff7b72.Td2a8ffclose_databaseTb4b4b4(Tb4b4b4)
Te6edf3exitTb4b4b4(Te6edf3return_codeTb4b4b4)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────